package com.example.music.Test;

import org.springframework.util.DigestUtils;

import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import java.util.*;

public class Test {


    private static ArrayList<Object> objects = new ArrayList<>();

    public static void main(String[] args) {
      /*  String[] array = new String[] {"1", "2", "3", "4"};
        arrangeAll(Arrays.asList(array), "");*/
        ArrayList<Object> list = new ArrayList<>();


        st(list, 0, list.size());


      /*  for (int i = 0; i < objects.size(); i++) {
            String s="NVPh5oo715z5DIWAeQlhMDsWXXQV4hwt"+objects.get(i)+"NVPh5oo715z5DIWAeQlhMDsWXXQV4hwt";
            String s1 = DigestUtils.md5DigestAsHex(s.getBytes());
            System.out.println(s1);
        }*/


    }

    private static void st(ArrayList<Object> list, int s, int len) {
        if (s == len) {
            String t = "";
            for (int i = 0; i < list.size(); i++) {
                t += list.get(i);
            }
            objects.add(t);
            return;
        }
        for (int i = s; i != len; i++) {
            Collections.swap(list, i, s);
            st(list, s + 1, len);
            Collections.swap(list, i, s);
        }

    }


}
